﻿@{
    var controller = this.ViewContext.Controller as LanLordzBaseController;
}
    <div class="UserInfoBox">
@if (controller.CurrentUser != null)
{
    using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { name = "LogOff" }))
    {
     @Html.AntiForgeryToken()
     @Html.Hidden("ReturnUrl", ((object)Model) is LanLordz.Models.LogOnAttemptModel ? ((LanLordz.Models.LogOnAttemptModel)(object)Model).ReturnUrl : Request.Url.ToString())
     <div class="UserInfoBoxLoggedOnInfo">Logged on as @Html.ActionLink(controller.CurrentUser.Username, "ViewProfile", "Account", new { id = controller.CurrentUser.UserID }, null).</div>
     <div class="UserInfoBoxAction"><a href="javascript:document.LogOff.submit()">Log Off</a></div>
     <div class="UserInfoBoxAction">@Html.ActionLink("Account", "Index", "Account")</div>
        if (controller.Security.IsUserInRole(controller.CurrentUser, controller.Config.CrewGroup))
        {
     <div class="UserInfoBoxAction">@Html.ActionLink("Crew", "Index", "Crew")</div>
        }
        
        if (controller.Security.IsUserAdministrator(controller.CurrentUser))
        {
     <div class="UserInfoBoxAction">@Html.ActionLink("Admin", "Index", "Admin")</div>
        }
    }
}
else
{
    using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { name = "LogOn" }))
    {
     @Html.AntiForgeryToken()
     @Html.Hidden("ReturnUrl", ((object)Model) is LanLordz.Models.LogOnAttemptModel ? ((LanLordz.Models.LogOnAttemptModel)(object)Model).ReturnUrl : Request.Url.ToString())
     <div class="UserInfoBoxInput">@Html.Label("Username", "Username:") @Html.TextBox("Username")</div>
     <div class="UserInfoBoxInput">@Html.Label("Password", "Password:") @Html.Password("Password")</div>
     <div class="UserInfoBoxInput">@Html.CheckBox("RememberMe") @Html.Label("RememberMe", "Remember Me")</div>
     <div class="UserInfoBoxInput"><input type="submit" value="Log On" /></div>
     <div class="UserInfoBoxAction">@Html.ActionLink("Register", "Register", "Account")</div>
     <div class="UserInfoBoxAction">@Html.ActionLink("Help", "Index", "Account")</div>
    }
}
    </div>